
<?php
require_once 'application/constant/templatName.php';
require_once 'application/library/cache/gcSession.php';
require_once 'application/library/controller/gcBasicAction.php';
require_once 'application/modules/login/services/login_services_LoginService.php';

/**
 * login_LoginController
 * @author    Soochow University
 * @version   1.0
 * @exclude   作  成  日：2011/05/01
 */
class login_LoginController extends gcBasicAction{
    
    /**
     * objService
     */
    private $objService;

    /**
     * indexAction
     */
    public function indexAction(){

        $userId = $this->getParam($id);
        $this->setPageUrlForQRCode();
        $this->pvSetPageInfo();
        $this->gcView->blnModel = true;
        $this->gcView->render(templatName::LOGIN_PAGE);
    }

    /**
     * loginAction
     */
    public function loginAction(){
        $strUserId   = $this->getParam("userId");
        $strPassword = $this->getParam("password");

        $objService = new login_services_LoginService();
        $strResult = $objService->pbCheckUserAccount($strUserId, $strPassword);
        if ($strResult == false) {
            jsonHelper::outPutJson(false);
        } else {
            //session set
            gcSession::setSession("userId",   $strUserId);
            gcSession::setSession("userType", $strResult["TYPE_FG"]);
            jsonHelper::outPutJson(true);
        }
        //$this->gcView->render(templatName::INDEX);
    }

    /**
     * pvSetPageInfo
     */
    private function pvSetPageInfo(){
        $this->gcView->title            = $this->getLabel("Login_Login");
        $this->gcView->Login_Staff      = $this->getLabel("Login_Staff");
        $this->gcView->Login_Member     = $this->getLabel("Login_Member");
        $this->gcView->Login_Password   = $this->getLabel("Login_Password");
        $this->gcView->Login_Reset      = $this->getLabel("Login_Reset");
        $this->gcView->Login_Notice     = $this->getLabel("Login_Notice");
        $this->gcView->Login_Forget     = $this->getLabel("Login_Forget");
    }
}

